package com.ms.education.order.utils;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class ConstantWxPayUtils implements InitializingBean {

    @Value("${wx.pay.app_id}")
    private String appId;

    @Value("${wx.pay.partner}")
    private String partner;

    @Value("${wx.pay.partner_key}")
    private String partnerKey;

    @Value("${wx.pay.notify_url}")
    private String notifyUrl;

    @Value("${wx.pay.spbill_create_ip}")
    private String spbillCreateIp;

    @Value("${wx.pay.pay_url}")
    private String payUrl;

    @Value("${wx.pay.order_query_url}")
    private String orderQueryUrl;

    public static String WX_PAY_APP_ID;
    public static String WX_PAY_PARTNER;
    public static String WX_PAY_PARTNER_KEY;
    public static String WX_PAY_NOTIFY_URL;
    public static String WX_PAY_SPBILL_CREATE_IP;
    public static String WX_PAY_PAY_URL;
    public static String WX_PAY_ORDER_QUERY_URL;

    @Override
    public void afterPropertiesSet() throws Exception {
        WX_PAY_APP_ID = appId;
        WX_PAY_PARTNER=partner;
        WX_PAY_PARTNER_KEY=partnerKey;
        WX_PAY_NOTIFY_URL=notifyUrl;
        WX_PAY_SPBILL_CREATE_IP=spbillCreateIp;
        WX_PAY_PAY_URL=payUrl;
        WX_PAY_ORDER_QUERY_URL=orderQueryUrl;
    }
}
